﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SecurityLog.Models;
using SecurityLog.Repositories;

namespace SecurityLog.UnitTests.RepositoryStubs
{
    public class LogRepositoryStub : ILogRepository
    {
        private Dictionary<int, Entry> _storage = new Dictionary<int, Entry>();

        public IEnumerable<SingleEntryViewModel> GetCurrentLog(DateTime time)
        {
            var list = new List<SingleEntryViewModel>();
            list.Add( new SingleEntryViewModel {ID = 1, dateCreated = DateTime.Parse("2010/11/30"), body = "Test", userName = "STG", category = "Sec"});
            return list;
        }

        public void InsertEntry(Entry entry)
        {
            _storage.Add(entry.Id, entry);
        }

        public void SaveChanges()
        {
        }

        public IEnumerable<Category> GetCategoryList()
        {
            var list = new List<Category>();
            list.Add(new Category() {Id = 1, Name = "security", ParentId = 2});
            return list;
        }

        public int Count()
        {
            return _storage.Count();
        }
    }
}
